<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>上传文件</title>
    <link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>
<div class="layui-upload">
    <button type="button" class="layui-btn layui-btn-normal" id="chooseFileId">选择文件</button>
    <button type="button" class="layui-btn" id="uploadFileId">开始上传</button>
</div>

<script src="layui/layui.js"></script>
<script>
    layui.use(['jquery','upload'], function(){
        var $ = layui.jquery;
        var upload = layui.upload;

        //选完文件后不自动上传
        upload.render({
            elem: '#chooseFileId'
            ,url: 'https://httpbin.org/post' //改成您自己的上传接口
            ,auto: false
            //,multiple: true
            ,bindAction: '#uploadFileId'
            ,done: function(res){
                layer.msg('上传成功');
                console.log(res)
            }
        });


    });
</script>
</body>
</html>